package com.zhou.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhou.domain.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserDao extends BaseMapper<User> {

    //根据ID查询
    @Select("select * from user where id= #{id}")
    User getById(int id);

    //添加用户
    @Insert("insert into user(name,age) values(#{name},#{age})")
    @Options(useGeneratedKeys=true,keyProperty="id",keyColumn="id")
    void save(User user);

    //修改用户
    @Update("update user set age=#{age},name=#{name},bookListJson=#{bookListJson} where id = #{id}")
    void updeta(User user);
}
